﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using OnlineCourse.JWTAuthorizePolicy;
using OnlineCourse.Model;

namespace OnlineCourse.API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class LikeCollectionController : ControllerBase
    {
        private readonly PermissionRequirement _requirement;
        private readonly Services.LikeCollectionService _usbll;
        public LikeCollectionController(ApplicationDbContext db, PermissionRequirement requirement)
        {

            _requirement = requirement;
            _usbll = new Services.LikeCollectionService(db);
        }
        /// <summary>
        /// 增加收藏
        /// </summary>
        /// <param name="CourseId"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        [HttpPost("Add")]
        public IActionResult Add(Guid CourseId, Guid UserId)
        {
            bool mark = _usbll.Add(CourseId ,UserId);

            return Ok(mark);
        }
        /// <summary>
        /// 取消收藏
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete("Delete")]
        public IActionResult Delete(Guid id)
        {
            bool mark = _usbll.Delete(id);
            return Ok(mark);
        }
    }
}